package com.hut.oa.model.dao.announce;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

import com.hut.oa.model.bean.Announce;
import com.hut.oa.model.bean.User;

public interface AnnounceDao extends PagingAndSortingRepository<Announce, Long>{
	Page<Announce> findByUser(User user,Pageable pageable);
	
	List<Announce> findByUser(User user);
	
	List<Announce> findByType(Integer type);
	
	//@Query("from Announce a inner join fetch a.announceUsers au where au.user=:user")
	//Page<Announce> findByAnnounceUser(@Param("user")User user,Pageable pageable);
	
	Announce findById(Long id);
	
	
}
